Added mypy type hinting to hooks, worker, encoding, payload, pin, sampler#2188
Merged
mergify[bot] merged 9 commits intoDataDog:masterfrom Mar 18, 2021
Merged
Added mypy type hinting to hooks, worker, encoding, payload, pin, sampler#2188mergify[bot] merged 9 commits intoDataDog:masterfrom
mergify[bot] merged 9 commits intoDataDog:masterfrom
Conversation
P403n1x87
reviewed
Mar 17, 2021
P403n1x87
reviewed
Mar 17, 2021
ddtrace/sampler.py
Outdated
|
|
||
| def __init__(self, sample_rate=1): | ||
| def __init__( | ||
| self, sample_rate=1 # type: float |
Contributor
There was a problem hiding this comment.
Suggested change
| self, sample_rate=1 # type: float | |
| self, sample_rate=1.0 # type: float |
Contributor
|
@Yun-Kim this pull request is now in conflict 😩 |
ddtrace/internal/_encoding.pyi
Outdated
| content_type: str | ||
| def _decode(self, data: Union[str, bytes]) -> Any: ... | ||
| def encode_trace(self, trace: List[Any]) -> bytes: ... | ||
| def join_encoded(self, objs: List[bytes]) -> Union[str, bytes]: ... |
Member
There was a problem hiding this comment.
Why Union[str, bytes]? It should just be bytes I'd think 🤔
Contributor
Author
There was a problem hiding this comment.
Ahh I assumed it should have the same return type as the input type for _decode, but makes sense I'll change that!
Kyle-Verhoog
previously approved these changes
Mar 17, 2021
Kyle-Verhoog
previously approved these changes
Mar 17, 2021
ddtrace/sampler.py
Outdated
| """ | ||
|
|
||
| def __init__(self, sample_rate=1): | ||
| def __init__(self, sample_rate=1.0): |
Member
There was a problem hiding this comment.
Can we do this change separately? There are further usages below that use ints
Contributor
Author
There was a problem hiding this comment.
Sounds fair to me, I'll address this in a separate PR then 👍
Kyle-Verhoog
approved these changes
Mar 18, 2021
jd
approved these changes
Mar 18, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Following #2180, the following files were type hinted for mypy:
Checklist